home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4525 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1014 b 

  1. Path: news.MWCI.NET!usenet
  2. From: stuffle@pcii.net
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Overload >> vs. Write Met
  5. Date: 30 Jan 1996 19:40:45 GMT
  6. Organization: MidWest Communications, Inc.
  7. Message-ID: <4els7t$n54@hihat.mwci.net>
  8. References: <60125190005$71C7@lasernet.com>
  9. Reply-To: stuffle@pcii.net
  10. NNTP-Posting-Host: lan-pm1-30.pcii.net
  11. X-Newsreader: IBM NewsReader/2 v1.2.5
  12.  
  13. In <60125190005$71C7@lasernet.com>, GEORGE BOUTWELL <george_boutwell@lasernet.com> writes:
  14. >Ok...
  15. >
  16. >  Which is 'better' OOP 'Style', and/or 'Correctness' for
  17. >Writing/Reading an Object's Data to/from Disk/Screen/Etc:
  18. >
  19. >Overloading the << and >>
  20. >-or-
  21. >writing a read method and a write method?
  22. >
  23. >Regards,
  24. >
  25. >George
  26. >
  27. > * OLX 1.53 * >ov++h+n AC*hanks for hanging up, dear.
  28.  
  29. I would say "make it streamable!!"  If for any other reason, simply because 
  30. it is a nice, object independent mechanism for writting to a stream.  Plus, the
  31. syntax is much cleaner.
  32.  
  33. ex:
  34. ostream    os;
  35. int        i;
  36. TObj1        to1;    // TObj1 & TObj2 NOT related.
  37. TObj2        to2;
  38.